package com.jlpay.openapi.demo.trans.common;

import com.jlpay.open.jlpay.sdk.java.model.trans.common.request.ChnQueryRequest;
import com.jlpay.open.jlpay.sdk.java.model.trans.common.response.ChnQueryResponse;
import com.jlpay.open.jlpay.sdk.java.utils.json.JsonUtils;
import com.jlpay.openapi.demo.JlpayOpenApiService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 *
 * @author dengwenning
 * @since 2024/9/23
 **/
public class ChnQueryService {
    private static final Logger LOGGER = LoggerFactory.getLogger(ChnQueryService.class);

    public static void main(String[] args) {
        ChnQueryRequest chnQueryRequest = buildChnQueryRequest();
        ChnQueryResponse chnQueryResponse = JlpayOpenApiService.openMerchService()
                .post(chnQueryRequest, ChnQueryResponse.class);
        LOGGER.info("订单查询响应:{}", JsonUtils.toString(chnQueryResponse));
    }

    private static ChnQueryRequest buildChnQueryRequest() {
        ChnQueryRequest chnQueryRequest = new ChnQueryRequest();

        chnQueryRequest.setMchId("849584358120018");
        chnQueryRequest.setOutTradeNo("ld201911023465529");
        chnQueryRequest.setTransactionId("80011557201909171853011568");

        return chnQueryRequest;
    }
}
